﻿using System;
using System.Collections.Generic;
using System.Text;

namespace RaisingStudio.Data.Entities
{
    public partial class _MutipleKeysTable : RaisingStudio.Data.Expressions.TableExpression, RaisingStudio.Data.Expressions.IQueryExpression<_MutipleKeysTable>
    {
        #region Constructor (s) / Destructor
        /// <summary>
        /// Constructor (s) / Destructor.
        /// </summary>
        public _MutipleKeysTable() : base("MutipleKeysTable")
        {
        }
        #endregion
        #region Members
        public static readonly RaisingStudio.Data.Expressions.ColumnExpression _Key1 = "Key1";
        public RaisingStudio.Data.Expressions.ColumnExpression Key1 { get { return _Key1; } }
        public static readonly RaisingStudio.Data.Expressions.ColumnExpression _Key2 = "Key2";
        public RaisingStudio.Data.Expressions.ColumnExpression Key2 { get { return _Key2; } }
        public static readonly RaisingStudio.Data.Expressions.ColumnExpression _Value1 = "Value1";
        public RaisingStudio.Data.Expressions.ColumnExpression Value1 { get { return _Value1; } }
        public static readonly RaisingStudio.Data.Expressions.ColumnExpression _Value2 = "Value2";
        public RaisingStudio.Data.Expressions.ColumnExpression Value2 { get { return _Value2; } }

		#endregion

        public static implicit operator RaisingStudio.Data.Expressions.ConditionExpression(_MutipleKeysTable MutipleKeysTable)
        {
            return new RaisingStudio.Data.Expressions.ConditionExpression();
        }

        public RaisingStudio.Data.Expressions.ConditionExpression OrderBy(RaisingStudio.Data.Expressions.ColumnExpression columnExpression)
        {
             RaisingStudio.Data.Expressions.ConditionExpression conditionExpression = this;
             return conditionExpression.OrderBy(columnExpression);
        }

        public RaisingStudio.Data.Expressions.ConditionExpression OrderBy(RaisingStudio.Data.Expressions.ColumnExpression columnExpression, RaisingStudio.Data.Expressions.SortingDirection sortingDirection)
        {
            RaisingStudio.Data.Expressions.ConditionExpression conditionExpression = this;
            return conditionExpression.OrderBy(columnExpression, sortingDirection);
        }

        public RaisingStudio.Data.Expressions.ConditionExpression Where(RaisingStudio.Data.Expressions.ExpressionElement expressionElement)
        {
            RaisingStudio.Data.Expressions.ConditionExpression conditionExpression = this;
            return conditionExpression.Where(expressionElement);
        }

        public static implicit operator RaisingStudio.Data.Expressions.ColumnExpressionCollection(_MutipleKeysTable MutipleKeysTable)
        {
            return new RaisingStudio.Data.Expressions.ColumnExpressionCollection(MutipleKeysTable);
        }

        public static implicit operator RaisingStudio.Data.Expressions.ColumnExpression[](_MutipleKeysTable MutipleKeysTable)
        {
            return new RaisingStudio.Data.Expressions.ColumnExpression[]
                        {                            
                            MutipleKeysTable.Key1,
                            MutipleKeysTable.Key2,
                            MutipleKeysTable.Value1,
                            MutipleKeysTable.Value2,
                        };
        }

        public RaisingStudio.Data.Expressions.ColumnExpressionCollection Except(params RaisingStudio.Data.Expressions.ColumnExpression[] columns)
        {
            RaisingStudio.Data.Expressions.ColumnExpressionCollection columnExpressionCollection = this;
            return columnExpressionCollection.Except(columns);
        }

    
        public static implicit operator RaisingStudio.Data.Expressions.QueryExpression<_MutipleKeysTable>(_MutipleKeysTable MutipleKeysTable)
        {
            return new RaisingStudio.Data.Expressions.QueryExpression<_MutipleKeysTable>(MutipleKeysTable);
        }


        #region IQueryExpression<_MutipleKeysTable> 成员

        _MutipleKeysTable RaisingStudio.Data.Expressions.IQueryExpression<_MutipleKeysTable>.Value
        {
            get { return MutipleKeysTable._; }
        }

        #endregion

        #region IQueryExpression 成员

        RaisingStudio.Data.Expressions.TableExpression RaisingStudio.Data.Expressions.IQueryExpression.Table
        {
            get { return this; }
        }

        RaisingStudio.Data.Expressions.ConditionExpression RaisingStudio.Data.Expressions.IQueryExpression.Condition
        {
            get { return this; }
        }

        RaisingStudio.Data.Expressions.ColumnExpressionCollection RaisingStudio.Data.Expressions.IQueryExpression.Columns
        {
            get { return null; }
        }

        #endregion
    }

    partial class MutipleKeysTable
    {
        #region Members
        public static readonly _MutipleKeysTable _ = new _MutipleKeysTable();
		#endregion
    }
}
